let admin = new Admin();
document.querySelector("#login").addEventListener("submit", function (e) {
	e.preventDefault();
	let formData = new FormData();
	formData.append("account", this.querySelector("#user").value);
	formData.append("password", this.querySelector("#password").value);
	// JSON.parse(result.request.responseText)
	axios
		.post("https://ty.php800.cn/api/member/login.php", formData)
		.then((result) => {
			console.log(result);
			let { verify, msg, token, user } = result.data;
			if (verify) {
				localStorage.setItem("token", token);
				localStorage.setItem("user", JSON.stringify(user));
				location.href = "index.html";
			} else {
				admin.popUpBox(verify, msg);
			}
		})
		.catch((err) => console.log(err));
});
admin.hide_show("#eye", "#password");
